import numpy as np
import ASVBaselineTool.FGSMATTACK as attack
import Config.attackconfig as Config
import torch
from SPEC1024_RESNET.model import Model_zoo

model_path = Config.SPEC1024_RESNET_model
labelPath = Config.TLABEL
datasetPath = Config.TPATH
AdvsetPath = Config.SPEC1024_RESNET_FGSMAdvsetPath

device = 'cuda' if torch.cuda.is_available() else 'cpu'
print(device)
model = Model_zoo("ResNet18")
model = (model).to(device)
model.load_state_dict(torch.load(model_path, map_location=device))
print('Model loaded : {}'.format(model_path))

a = attack.FRAMEFGSM(model,labelPath,datasetPath,AdvsetPath)
feature = "spec_1024"
for eps in np.linspace(0.01,0.05,33):
    a.Attack(feature,eps=eps)
